package com.cg.design.depthdesign.abstractfactory.app;

import com.cg.design.depthdesign.abstractfactory.buttons.Button;
import com.cg.design.depthdesign.abstractfactory.checkbes.Checkbox;
import com.cg.design.depthdesign.abstractfactory.factories.GUIFactory;

/**
 * 客户端
 * <p>
 * 工厂用户并不关心他们使用的是哪个具体的工厂，因为他们通过抽象接口来处理工厂和产品。
 *
 * @program: LeetCode->Application
 * @author: cg
 * @create: 2022-04-07 09:35
 **/
public class Application {

    /**
     * 按钮产品
     */
    private Button button;
    /**
     * 复选框产品
     */
    private Checkbox checkbox;

    /**
     * 构造函数
     *
     * @param factory
     */
    public Application(GUIFactory factory) {
        button = factory.createButton();
        checkbox = factory.createCheckbox();
    }

    /**
     * 绘图
     */
    public void paint() {
        button.paint();
        checkbox.paint();
    }

}
